home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / opalvisn / jopalif.lha / JForthDemo.f < prev    next >
Text File  |  1993-01-01  |  2KB  |  53 lines

  1. \ A Mindless Demo of the JForth Language Interface for OpalVision's Opal.Library
  2. \
  3. \ Version 1.0 - 31 December 1992
  4. \
  5. \ By Marlin Schwanke
  6.  
  7. decimal
  8.  
  9. \ Include the OpalVision support code.
  10.  
  11. include JFHD:Opal/JForth/Opal.f
  12.  
  13. \ And now the mindless demo.
  14. : .ESC ( -- , Emit escape character )
  15.    27 emit
  16. ;
  17.  
  18. : IFF24 ( <fileword> -- , load an image into the OpalVision board )
  19.    \ Load Opal library
  20.    opal?                                     ( -- )
  21.    \ Turn off existing display, if any
  22.    closescreen24()                           ( -- )
  23.    \ Display credits
  24.    CR .esc ." [32m"                    ( -- )
  25.    ." IFF24 by Marlin Schwanke"        ( -- )
  26.    .esc ." [31m" CR CR                 ( -- )
  27.    \ Get filename from command line
  28.    0 fileword                                ( 0 $addr )
  29.    \ If filename present then try to open
  30.    dup c@                                    ( 0 $addr count )
  31.    if                                        ( 0 $addr )
  32.       ." Loading..." CR CR                   ( 0 $addr )
  33.       dup $>0 force24 loadiff24()            ( result )
  34.       \ Check status after loadiff24
  35.       dup OL_ERR_MAXERR >                    ( result flag )
  36.       over 0 <= or                           ( result flag )
  37.       \ Display picture if status ok
  38.       if                                     ( result )
  39.          drop                                ( -- )
  40.          refresh24()                         ( -- )
  41.       \ Print error message, error code, and usage on error
  42.       else                                   ( result )
  43.          ." Opal Library Error: " . CR       ( -- )
  44.          ." Syntax is: IFF24 filename" CR CR ( -- )
  45.       then                                   ( -- )
  46.    \ 0 length filename clear stack and exit
  47.    else                                      ( 0 $addr )
  48.       ddrop                                  ( -- )
  49.    then                                      ( -- )
  50.    \ Unload the library and exit
  51.    -Opal
  52. ;
  53.